home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 6 / FM Towns Free Software Collection 6.iso / t_os / catlog / source / display.c < prev    next >
C/C++ Source or Header  |  1993-07-08  |  16KB  |  681 lines

  1. /*
  2.     NIFTYのLOG整理                display.c
  3.                     by GHH01217 山先
  4.     $Header: DISPLAY.Cv  1.2  93/02/12 22:47:24  山先  Exp $
  5. */
  6.  
  7. #undef        TYPE_LINUX
  8.  
  9. #ifndef        TYPE_LINUX
  10.  
  11. #include    "log.h"
  12.  
  13. #include    <egb.h>
  14. #include    <mos.h>
  15.  
  16. #define        TEST    1
  17. #undef        TEST
  18.  
  19. static    void    display_ini();
  20.  
  21. static    char    para[ 64 ];
  22. static    char    work[ EgbWorkSize ];
  23.  
  24. #ifdef    TEST
  25. static    char    mwork[ MosWorkSize ];
  26. static    int    mouse_ch,mouse_x,mouse_y;
  27. #endif    /* TEST */
  28.  
  29. extern    short    cons_cur_lin;
  30. extern    short    cons_cur_x;    /* 画面上のカーソルの x 座標 */
  31. extern    short    cons_cur_y;    /* 画面上のカーソルの y 座標 */
  32.  
  33. struct WINDOW    {
  34.             int    pag;
  35.             int    x1,x2,y1,y2;    /* (x1,y1) - (x2,y2) の範囲 */
  36.             int    fc,bc;        /* 文字の色 */
  37.             short    cur_x,cur_y;    /* カーソルの位置 */
  38.             char    win_mes[ 84 ];    /* 窓の表題 */
  39.             char    file_name[ 128 ];
  40.             char    *start , *end;    /* 表示文字列へのポインタ */
  41.             char    *buf;
  42.             char    *ptr;
  43.             int    w_putch_sw;
  44. };
  45.  
  46. #define    MAX_WINDOW    20
  47.  
  48. static    struct    WINDOW    window[ MAX_WINDOW ];
  49.  
  50. static    int    win_p[ MAX_WINDOW ];
  51. static    int    win_used[ MAX_WINDOW ];
  52. static    int    max_win = 0;
  53. static    int    cur_win = 0;
  54.  
  55. #define    MAX_BUF    1024*64        /* 64 Kbytes */
  56.  
  57. static    int        CatlogMesFileSet = NO;
  58. static    FILE    *CMFF = NULL;
  59.  
  60. static    void    w_putch_err( int num , int ch )
  61. {
  62.     catlog_mes_file_name_sw = NO;
  63.     CatlogMesFileSet = NO;
  64.     switch( num ) {
  65.         case 1:    printf("\n<%s>がオープンできません。",catlog_mes_file_name);
  66.                 break;
  67.         case 2:    printf("\n<%2x>が書き出せません。",ch);
  68.                 break;
  69.         default:    break;
  70.     };
  71.     exit( 1 );
  72. }
  73.  
  74. void    catlog_mes_file_open()
  75. {
  76.     if ( catlog_mes_file_name_sw == NO ) return;    /* ファイルに記録しない */
  77.  
  78.     if ( ( CMFF = fopen( catlog_mes_file_name , "wb" ) ) == NULL ) {
  79.         check_and_make_output_path( catlog_mes_file_name );
  80.         if ( ( CMFF = fopen( catlog_mes_file_name , "wb" ) ) == NULL ) {
  81.             w_putch_err( 1 , EOF );
  82.         };
  83.     };
  84.     CatlogMesFileSet = YES;
  85.     fprintf( CMFF , "CATLOG %sです。\n<%s>で処理を行っています。\n" ,
  86.         VERSION , file_name
  87.     );
  88. }
  89.  
  90. void    catlog_mes_file_close()
  91. {
  92.     if ( catlog_mes_file_name_sw == NO ) return;    /* ファイルに記録しない */
  93.  
  94.     if ( CatlogMesFileSet == NO )    return;            /* 既にクローズしている */
  95.  
  96.     fclose( CMFF );
  97.     CatlogMesFileSet = NO;
  98. }
  99.  
  100. void    catlog_mes_file_reopen()
  101. {
  102.     if ( catlog_mes_file_name_sw == NO ) return;    /* ファイルに記録しない */
  103.  
  104.     if ( CatlogMesFileSet == YES )    return;            /* 二重にオープン */
  105.  
  106.     if ( ( CMFF = fopen( catlog_mes_file_name , "ab" ) ) == NULL ) {
  107.         w_putch_err( 1 , 0 );
  108.     };
  109.     CatlogMesFileSet = YES;
  110. }
  111.  
  112. static    int    CatlogMesFile0d = NO;
  113.  
  114. static    void    w_putch_sub( int ch )
  115. {
  116.     if ( catlog_mes_file_name_sw == NO ) return;    /* ファイルに記録しない */
  117.  
  118.     if ( CatlogMesFileSet == NO )        return;        /* ファイルはクローズ中 */
  119.  
  120.     ch = ch & 0xff;
  121.     if ( ch == 0x0d ) {
  122.         if ( CatlogMesFile0d == YES )    return;
  123.         CatlogMesFile0d = YES;
  124.     } else {
  125.         CatlogMesFile0d = NO;
  126.         if ( ch == EOF )        return;
  127.     };
  128.     if ( fputc( ch , CMFF ) == EOF ) w_putch_err( 2 , ch );
  129. }
  130.  
  131. void    w_putch( const int ch )
  132. {
  133.     char    *p1,*p2,*p3;
  134.  
  135.     w_putch_sub( ch );
  136.  
  137.     if ( window[ cur_win ].w_putch_sw == 0 ) return;
  138.  
  139.     p1 = p2 = window[ cur_win ].buf;
  140.     p3 = window[ cur_win ].ptr;
  141.  
  142.     /* 行頭の処理 */
  143.     if ( cons_cur_x == 0 ) {
  144.         /* その文字が行頭になる */
  145.     } else if ( cons_cur_x == 2 ) {
  146.         if ( p3 - p1 > 1 ) {
  147.             if ( iskanji( *(p3-2) ) ) {
  148.                 /* - 2 が行頭 */
  149.             };
  150.         };
  151.     };
  152.  
  153.     if ( window[ cur_win ].w_putch_sw == 1 ) return;
  154.  
  155.     /* 以下、 buffer に保存する */
  156.     *p3++ = ch;
  157.     window[ cur_win ].ptr++;
  158.     if ( window[ cur_win ].ptr - window[ cur_win ].buf >= MAX_BUF ) {
  159.         while ( p1 < p3 ) {
  160.             if ( *p1 == '\n' ) {    p1++;    break;    };
  161.             p1++;
  162.         };
  163.         while ( p1 < p3 ) *p2++ = *p1++;
  164.         window[ cur_win ].ptr = p2;
  165.     };
  166. }
  167.  
  168. static    void    w_open_sub( int win0 )
  169. {
  170.         int    fc,bc,pag;
  171.         int    x1,x2,y1,y2;
  172.         int    win;
  173.  
  174.     if ( win0 < 0 || MAX_WINDOW <= win0 ) return;
  175.  
  176.     window[ cur_win ].w_putch_sw = 0;
  177.  
  178.     win = win_p[ win0 ];
  179.  
  180.     pag = window[ win ].pag;
  181.     x1 = window[ win ].x1;    y1 = window[ win ].y1;
  182.     x2 = window[ win ].x2;    y2 = window[ win ].y2;
  183.     fc = window[ win ].fc;    bc = window[ win ].bc;
  184.  
  185.     CON_close();                /* 現在の画面をクローズ */
  186.     CON_open(pag,x1,y1,x2,y2,fc,bc);
  187.     /* MES の表示 */
  188.     cprintf("%s",window[ win ].win_mes);
  189.     CON_close();
  190.     CON_open(pag,x1,y1+16,x2,y2,fc,bc);
  191.  
  192.     EGB_color( work , 0 , 0x1f );
  193.     EGB_writeMode( work , 0 );        /* write PSET mode */
  194.     WORD( para + 0 ) = x1-1;
  195.     WORD( para + 2 ) = y1-1;
  196.     WORD( para + 4 ) = x1 + ( (x2-x1+1) & 0xfff8 );
  197.     WORD( para + 6 ) = y1 + ( (y2-y1+1) & 0xfff0 );
  198.     EGB_rectangle( work , para );
  199.     WORD( para + 2 ) = y1 - 1 + 16;
  200.     EGB_rectangle( work , para );
  201.  
  202.     if ( window[ win ].buf != NULL ) {
  203.         x1 = *window[ win ].ptr;
  204.         *window[ win ].ptr = '\0';
  205.         puts( window[ win ].buf );
  206.         *window[ win ].ptr = x1;
  207.     };
  208.  
  209.     window[ cur_win ].w_putch_sw = 0;
  210. }
  211.  
  212. static    int    w_open( int x1 , int y1 , int x2 ,int y2 , char *mes )
  213. {
  214.         int    fc,bc,pag;
  215.         int    xs1,xs2,ys1;
  216.         char    sub[ 84 ];
  217.  
  218.     pag = 1;    fc = 15;    bc = 9;
  219.  
  220.     /************************/
  221.     /* 今の窓の値を保存する */
  222.     /************************/
  223.     if ( win_p[ cur_win ] >= 0 ) {
  224.         window[win_p[cur_win]].cur_x = cons_cur_x;
  225.         window[win_p[cur_win]].cur_y = cons_cur_y;
  226.     };
  227.  
  228.     /********************************/
  229.     /* 以下、新しい窓のデータの設定 */
  230.     /********************************/
  231.     for ( xs1 = 0 ; xs1 < MAX_WINDOW ; xs1++ ) {
  232.         if ( win_used[ xs1 ] < 0 ) break;
  233.     };
  234.     if ( xs1 >= MAX_WINDOW ) {
  235.         cputs( "\nウィンドウを開けません" );    get_yesno();
  236.         return( FALSE );
  237.     };
  238.     win_used[ xs1 ] = 1;        /* 使用中である */
  239.     win_p[ max_win ] = xs1;
  240.     cur_win = xs1;
  241.     max_win++;
  242.  
  243.     window[ cur_win ].start = window[ cur_win ].end = NULL;
  244.     window[ cur_win ].buf = window[ cur_win ].ptr = NULL;
  245.     window[ cur_win ].pag = pag;
  246.     window[ cur_win ].x1 = x1;    window[ cur_win ].y1 = y1;
  247.     window[ cur_win ].x2 = x2;    window[ cur_win ].y2 = y2;
  248.     window[ cur_win ].fc = fc;    window[ cur_win ].bc = bc;
  249.  
  250.     /**************/
  251.     /* 表題の設定 */
  252.     /**************/
  253.     xs1 = ( x2 - x1 + 1 ) / 8 - 2;    /* 表示できる桁数 */
  254.     if ( strlen( mes ) == 0 ) {    strcpy( str , "指定して下さい" );
  255.     } else {
  256.         if ( str != mes ) {    strcpy( str , mes );
  257.         };
  258.     };
  259.     if ( xs1 < 1 ) strcpy( str , "" );    /* 表題は'E'だけ */
  260.  
  261.     str[ xs1 ] = '\0';        /* 表示できる桁数だけしか表示しない */
  262.  
  263.     xs2 = strlen( str );        /* 表題の文字数 */
  264.  
  265.     strcpy( sub , "E------------------------------------------------------------------------------" /* 80文字 */ );
  266.     ys1 = ( xs1 - xs2 ) / 2 - ( xs1 - xs2 ) % 2;    /* 書き始めの位置 */
  267.     if ( ys1 < 2 ) ys1 = 2;
  268.     strncpy( sub + ys1 , str , xs2 );
  269.     sub[ xs1 ] = '\0';
  270.     strcpy( window[ cur_win ].win_mes , sub );
  271.  
  272.     w_open_sub( cur_win );
  273.  
  274.     return( TRUE );
  275. }
  276.  
  277. void    replace_window( int x1 , int y1 )    /* 左上の座標を指定 */
  278. {
  279.     int    i,dx,dy;
  280.     int    win;
  281.  
  282.     win = win_p[ cur_win ];
  283.  
  284.     dx = x1 - window[ win ].x1;
  285.     dy = y1 - window[ win ].y1;
  286.  
  287.     window[ win ].x1 += dx;        window[ win ].y1 += dy;
  288.     window[ win ].x2 += dx;        window[ win ].y2 += dy;
  289.  
  290.     if ( window[ win ].x1 < 0 )    window[ win ].x1 = 0;
  291.     if ( window[ win ].y1 < 0 )    window[ win ].y1 = 0;
  292.     if ( 639 < window[ win ].x2 )    window[ win ].x2 = 639;
  293.     if ( 479 < window[ win ].y2 )    window[ win ].y2 = 479;
  294.  
  295.     /* 全部の窓を再度開ける */
  296.     CON_close();
  297.     CON_open(1,0,16,639,479,15,9);
  298.     for ( i=0 ; i<max_win ; i++ ) {
  299.         w_open_sub( i );
  300. /*
  301.         cons_cur_x = window[win_p[ i ]].cur_x;
  302.         cons_cur_y = window[win_p[ i ]].cur_y;
  303. */
  304.     };
  305. }
  306.  
  307. #ifdef    TEST
  308. static    void    w_close()
  309. {
  310.     int    i,j;
  311.  
  312.     win_used[ cur_win ] = win_p[ cur_win ] = -1;
  313.  
  314.     for ( i = 0 ; i < max_win ; i++ ) {
  315.         if ( win_p[ i ] < 0 ) {
  316.             for ( j=i+1 ; j<max_win ; j++ ) {
  317.                 win_p[j-1] = win_p[j];
  318.             };
  319.         };
  320.     };
  321.  
  322.     if ( --max_win < 0 ) {
  323.         cputs("\nウィンドゥを閉じられません");    get_yesno();
  324.         max_win = 0;    return;
  325.     };
  326.  
  327.     /* 全部の窓を再度開ける */
  328.     CON_close();
  329.     CON_open(1,0,16,639,479,15,9);
  330.     for ( i=0 ; i<max_win ; i++ ) {
  331.         w_open_sub( i );
  332. /*
  333.         cons_cur_x = window[win_p[ i ]].cur_x;
  334.         cons_cur_y = window[win_p[ i ]].cur_y;
  335. */
  336.     };
  337. }
  338.  
  339. static    void    get_com_xor( int y )
  340. {
  341.     MOS_disp( 0 );
  342.     y = y * 16;
  343.     y += window[win_p[ cur_win ]].y1;
  344.     EGB_writeMode( work , 4 );    /* XOR */
  345.     EGB_paintMode( work , 0x22 );
  346.     EGB_color( work , 0 , 0x09 );
  347.     WORD( para + 0 ) = window[win_p[ cur_win ]].x1;
  348.     WORD( para + 2 ) = y;
  349.     WORD( para + 4 ) = window[win_p[ cur_win ]].x2;
  350.     WORD( para + 6 ) = y + 16;
  351.     EGB_rectangle( work , para );
  352.     EGB_writeMode( work , 0 );    /* PSET */
  353.     EGB_paintMode( work , 0x02 );
  354.     EGB_color( work , 0 , 0x1f );
  355.     MOS_disp( 1 );
  356. }
  357.  
  358. int    get_command( int x1 , int y1 , char *command[] )
  359. {
  360.     int    n,l,max,re,re0;
  361.     int    x2,y2;
  362.  
  363.     /* コマンドの数を数える */
  364.     n = max = 0;
  365.     while ( ( l = strlen( command[n] ) ) != 0 ) {
  366.         if ( max < l ) max = l;
  367.         n++;
  368.     };
  369.     max++;
  370.     if ( max < 18 ) max = 18;
  371.  
  372.     /* ウィンドウのオープン */
  373.     x2 = x1 + max * 8;    y2 = y1 + (n+1) * 16;
  374.     w_open( x1 , y1 , x2 , y2 , "選択して下さい" );
  375.  
  376.     y1 += 16;
  377.  
  378.     /* コマンドの表示 */
  379.     for ( l=0 ; l<n ; l++ ) printf( "\n%s" , command[ l ] );
  380.  
  381.     /* マウスの指定 */
  382.     MOS_disp( 1 );        /* マウスの表示 */
  383.     mouse_ch = 1;    l = FALSE;    re = re0 = 0;
  384.     while ( mouse_ch != 0 ) MOS_rdpos( &mouse_ch , &mouse_x , &mouse_y );
  385.     forever {
  386.         if ( l == TRUE && mouse_ch == 0 ) break;
  387.         MOS_rdpos( &mouse_ch , &mouse_x , &mouse_y );
  388.         if ( mouse_ch == 2 /* 右ボタン */ ) {
  389.             re = 0;    break;
  390.         };
  391.         if ( mouse_ch == 1 /* 左ボタン */ ) {
  392.             l = TRUE;
  393.             if ( x1<=mouse_x && mouse_x<x2
  394.             &&   y1<=mouse_y && mouse_y<y2
  395.             ) {    /* 窓の内側に入っている */
  396.                 re = ( mouse_y - y1 ) / 16 + 1;
  397.                 if ( re != re0 ) {
  398.                     if ( re0 != 0 ) get_com_xor( re0 );
  399.                     re0 = re;
  400.                     get_com_xor( re0 );
  401.                 };
  402.             } else {
  403.                 re = 0;
  404.             };
  405.         };
  406.     };
  407.     MOS_disp( 0 );        /* マウスの消去 */
  408.     if ( re0 != 0 ) get_com_xor( re0 );
  409.     w_close();
  410.     return ( re );
  411. }
  412.  
  413. int    get_yesno_mouse( char *mes )
  414. {
  415.     int    re;
  416.     int    x,y;
  417.  
  418.     x = 20 * 8;
  419.     y = 5 * 16;
  420.  
  421.     /* ウィンドウのオープン */
  422.     w_open( x , y , x + 26*2*8 , y+48 , mes );
  423.     /* メッセージの表示 */
  424.     cputs("YESなら左ボタン、NOなら右ボタンを押して下さい。");
  425.     /* get YES or NO */
  426.     MOS_disp( 1 );
  427.     mouse_ch = 1;
  428.     while ( mouse_ch != 0 ) MOS_rdpos( &mouse_ch , &mouse_x , &mouse_y );
  429.     forever {
  430.         MOS_rdpos( &mouse_ch , &mouse_x , &mouse_y );
  431.         if ( mouse_ch == 2 /* 右ボタン */ ) {
  432.             re = NO;    break;
  433.         };
  434.         if ( mouse_ch == 1 /* 左ボタン */ ) {
  435.             re = YES;    break;
  436.         };
  437.     };
  438.     while ( mouse_ch != 0 ) MOS_rdpos( &mouse_ch , &mouse_x , &mouse_y );
  439.     MOS_disp( 0 );
  440.     /* ウィンドウのクローズ */
  441.     w_close();
  442.     return( re );
  443. }
  444.  
  445. #endif    /* TEST */
  446.  
  447. #ifdef    TEST
  448. static    char    *test[] = {
  449.             "test1",
  450.             "test2",
  451.             "test3です",
  452.             "test4だよ~~",
  453.             "test5(おしまい)",
  454.             ""
  455. };
  456.  
  457. static    int    CATLOG_edit()
  458. {
  459.     int    i , sw;
  460.  
  461.     CON_close();
  462.     EGB_clearScreen( work );
  463.  
  464.     strcpy( str , "oricon g:\\downdata\\vz\\vzfmt.com display.c" );
  465.     strcpy( str , "oricon" );
  466.     strcpy( str , "console d:\\exe\\wink.exe display.c /TF:" );
  467.     strcpy( str , "oricon d:\\exe\\wink.exe display.c /TF:" );
  468.  
  469.     if ( system( str ) < 0 ) {
  470.         copen();
  471.         printf("<%s>\nを実行できませんでした。\n",str);
  472.         printf("処理を続けますか?");
  473.         if ( get_yesno() == NO ) exit( 1 );
  474.         sw = FALSE;
  475.     } else {
  476.         sw = TRUE;
  477.     };
  478.  
  479.     /* 画面を消去するために以下を入れる */
  480.     display_ini();
  481.  
  482.     /* 窓を全部開ける */
  483.     for ( i=0 ; i<max_win ; i++ ) w_open_sub( i );
  484.  
  485.     return( sw );
  486. }
  487.  
  488. #endif
  489.  
  490. static    int    display_mouse_sw = FALSE;
  491.  
  492. static    void    display_ini()
  493. {
  494.     EGB_init( work , EgbWorkSize );
  495.     EGB_resolution( work , 0 , 3 );
  496.     EGB_resolution( work , 1 , 3 );
  497.  
  498.     EGB_writePage( work , 1 );
  499.  
  500.     EGB_displayPage( work , 0 , 1 );
  501.     EGB_displayStart( work , 0 , 0 , 0 );
  502.  
  503.     /******************/
  504.     /* マウスの初期化 */
  505.     /******************/
  506.     /**************************************/
  507.     /* exit() で MOS_end() を実行している */
  508.     /**************************************/
  509. /*
  510.     if ( display_mouse_sw == FALSE ) {
  511.         MOS_start( mwork , MosWorkSize );
  512.         MOS_resolution( 0 , 3 );
  513.         MOS_writePage( 0 );
  514.         MOS_horizon( 0 , 639 );
  515.         MOS_vertical( 0 , 479 );
  516.         MOS_sysIcon(81,0,0,1);
  517.         display_mouse_sw = TRUE;
  518.     };
  519. */
  520.     /*****************************************************************/
  521.     /* 必要な時に MOS_disp( 1 ) を実行すること。常時は MOS_disp( 0 ) */
  522.     /*****************************************************************/
  523.  
  524. /*
  525.     CON_close();
  526.     CON_open(1,0,0,639,480,0x1f,0);    CON_close();
  527.     CON_open(0,0,0,639,480,0x1f,0);    CON_close();
  528. */
  529.  
  530.     sprintf( str , " CATLOG %s  by GHH01217 山先 " , VERSION );
  531.  
  532.     w_open( 0 , 0 , 640 , 480 , str );
  533. }
  534.  
  535. void    display_main()
  536. {
  537. #ifdef    TEST
  538.     int    cc,x;
  539. #endif
  540.     int    i;
  541.  
  542.     /* win_p[] win_used[] の値を初期化しておく */
  543.     for( i=0 ; i<MAX_WINDOW ; i++ ) win_p[ i ] = win_used[ i ] = -1;
  544.  
  545. /*
  546.     copen();
  547. */
  548.  
  549.     display_ini();
  550.  
  551. #ifdef    TEST
  552. /*
  553.     strcpy( file_name , "f:\\log_out\\ffmpro\\mes11_00.txt" );
  554.     if ( (catlog_fpi=fopen( file_name , "r" )) == NULL ) {
  555.         printf("<%s>をオープンできません。\n",file_name);
  556.         get_yesno();    exit( 1 );
  557.     };
  558.     while ( fgets( str , LINE , catlog_fpi ) != NULL ) printf("%s",str);
  559.     fclose( catlog_fpi );    exit( 0 );
  560. */
  561. /*
  562.     system( "c:\\command.com" );    exit( 0 );
  563. */
  564. /*
  565.     CATLOG_edit();            exit( 0 );
  566. */
  567.  
  568.     w_open( 10 , 10 , 500 , 200 , " CATLOG 1.0  by GHH01217 山先 その2" );
  569.  
  570.     for ( cc = 0 ; cc < 15 ; cc++ ) {
  571.         cputs( "\nあああああああああああああああああああ" );
  572.         cputs( "\nいいいいいいいいいいいいいいいいいいい" );
  573.     };
  574.  
  575.     for ( x = 20 ; x<100 ; x+=10) {
  576.         cprintf("\n(%d,%d)に移動するよ。",x,x);
  577.         replace_window( x , x );
  578.     };
  579.  
  580.     w_open( 10 ,310 , 630 , 470 , " CATLOG 1.0  by GHH01217 山先 その3" );
  581.  
  582.     forever {
  583.         sprintf( str , "commad=%dが指定されました\n\t終了しますか?",
  584.             get_command( 200 , 200 , test )
  585.         );
  586.         if ( get_yesno_mouse( str ) == YES ) {
  587.             exit( 0 );
  588.         };
  589.     };
  590.  
  591. #endif    /* TEST */
  592.  
  593. }
  594.  
  595. #ifdef    TEST
  596. void    display_dos_command(
  597.         int    x1,    int    y1,
  598.         int    x2,    int    y2,
  599.         char    *command
  600. ) {
  601.     w_open( x1 , y1 , x2 , y2 , command );
  602.     window[ cur_win ].ptr = 
  603.         window[ cur_win ].buf = (char *)malloc( MAX_BUF );
  604.     if ( window[ cur_win ].buf == NULL ) {
  605.         window[ cur_win ].w_putch_sw = 0;
  606.     } else {
  607.         window[ cur_win ].w_putch_sw = 2;
  608.     };
  609.     system( command );
  610.     if ( window[ cur_win ].buf != NULL ) free( window[ cur_win ].buf );
  611.     w_close();
  612. }
  613.  
  614. void    display_file(
  615.         int    x1,    int    y1,
  616.         int    x2,    int    y2,
  617.         char    *file_name
  618. ) {
  619.     FILE    *fp;
  620.  
  621.     w_open( x1 , y1 , x2 , y2 , file_name );
  622.     window[ cur_win ].ptr = 
  623.         window[ cur_win ].buf = (char *)malloc( MAX_BUF );
  624.     if ( window[ cur_win ].buf == NULL ) {
  625.             window[ cur_win ].w_putch_sw = 0;
  626.     } else {    window[ cur_win ].w_putch_sw = 1;
  627.     };
  628.     if ( (fp = fopen( file_name , "r" )) != NULL ) {
  629.     };
  630.     fclose( fp );
  631.     if ( window[ cur_win ].buf != NULL ) free( window[ cur_win ].buf );
  632.     w_close();
  633. }
  634.  
  635. #endif    /* TEST */
  636.  
  637. void    CATLOG_color( int col )
  638. {
  639.     if ( col < 8 ) col += 8;
  640.     ctblset( col , window[ win_p[ cur_win ] ].bc );
  641. }
  642.  
  643. void    CATLOG_exit( int re )
  644. {
  645.     printf(" \nCATLOGを終了します" );
  646.     if ( re != 0 ) {
  647.         printf( " リターン・キーを押して下さい。" );
  648.         get_yesno();
  649.         putchar( '\n' );
  650.     };
  651.  
  652.     if ( CatlogMesFileSet == YES ) fclose( CMFF );
  653.  
  654.     CON_close();
  655. /*
  656.     EGB_init( work , EgbWorkSize );
  657.  
  658.     EGB_displayPage( work , 0 , 1 );
  659. */
  660.     EGB_color( work , 1 , 0 );
  661.     EGB_clearScreen( work );
  662.     EGB_writePage( work , 0 );
  663.     EGB_clearScreen( work );
  664.     EGB_resolution( work , 0 , 1 );
  665.     EGB_resolution( work , 1 , 1 );
  666.     if ( display_mouse_sw != FALSE ) MOS_end();
  667.     _dos_exit( re );
  668. }
  669.  
  670. #else        /* TYPE_LINUX */
  671.  
  672. void    catlog_mes_file_open(){};
  673. void    catlog_mes_file_close(){};
  674. void    catlog_mes_file_reopen(){};
  675. void    display_main(){};
  676. void    CATLOG_color( int col ){};
  677. void    w_putch( const int ch ){};
  678. void    CATLOG_exit( int re ){};
  679.  
  680. #endif        /* TYPE_LINUX */
  681.